/*
 * Copyright 2010 - 2011, The PLDesktop Development Team
 *
 *  This library is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU Lesser General Public
 *  License as published by the Free Software Foundation; either
 *  version 2.1 of the License, or (at your option) any later version.
 *
 *  This library is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 *  Lesser General Public License for more details.
 *
 *  You should have received a copy of the GNU Lesser General Public
 *  License along with this library; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 *
 */
#ifndef PLELF_SYMBOL_TABLE_ENUM_H
#define PLELF_SYMBOL_TABLE_ENUM_H

namespace PLSDK {

/**
 * Enum values from the elf symbol table.
 */
class PLELFSymbolTableEnum {
public:
	/**
	 * Constructor.
	 */
	inline PLELFSymbolTableEnum() {}
	/**
	 * A symbol's binding determines the linkage visibility and behavior.
	 */
	enum STInfoBinding {
		/**
		 * Local symbols are not visible outside the object file containing their
		 * definition. Local symbols of the same name may exist in multiple files
		 * without interfering with each other.
		 */
		STInfoBindingLocal			= 0,
		/**
		 * Global symbols are visible to all object files being combined. One file's
		 * definition of a global symbol will satisfy another file's undefined
		 * reference to the same global symbol.
		 */
		STInfoBindingGlobal			= 1,
		/**
		 * Weak symbols resemble global symbols, but their definitions have lower precedence.
		 */
		STInfoBindingWeak           = 2,
		/**
		 * Values in this inclusive range are reserved for operating system-specific semantics.
		 */
		STInfoBindingLoos			= 10,
		/**
		 * Values in this inclusive range are reserved for operating system-specific semantics.
		 */
		STInfoBindingHiOS			= 12,
		/**
		 * Values in this inclusive range are reserved for processor-specific semantics.
		 * If meanings are specified, the processor supplement explains them.
		 */
		STInfoBindingLoProcessor	= 13,
		/**
		 * Values in this inclusive range are reserved for processor-specific semantics.
		 * If meanings are specified, the processor supplement explains them.
		 */
		STInfoBindingHiProcessor	= 15
	};
	/**
	 * A symbol's type provides a general classification for the associated entity.
	 */
	enum STInfoTypes {
		/**
		 * The symbol's type is not specified.
		 */
		STInfoTypesNoType			= 0,
		/**
		 * The symbol is associated with a data object, such as a variable, an array, and so on.
		 */
		STInfoTypesObject			= 1,
		/**
		 * The symbol is associated with a function or other executable code.
		 */
		STInfoTypesFunction			= 2,
		/**
		 * The symbol is associated with a section. Symbol table entries of this type exist
		 * primarily for relocation and normally have STInfoBindingLocal binding.
		 */
		STInfoTypesSection			= 3,
		/**
		 * Conventionally, the symbol's name gives the name of the source file associated with
		 * the object file. A file symbol has STInfoBindingLocal binding, its section index is
		 * SectionHeaderTableIndex_ABS, and it precedes the other STInfoBindingLocal symbols
		 * for the file, if it is present.
		 */
		STInfoTypesFile				= 4,
		/**
		 * The symbol labels an uninitialized common block.
		 */
		STInfoTypesCommon			= 5,
		/**
		 * Values in this inclusive range are reserved for operating system-specific semantics.
		 */
		STInfoTypesLoos				= 10,
		/**
		 * Values in this inclusive range are reserved for operating system-specific semantics.
		 */
		STInfoTypesHiOS				= 12,
		/**
		 * Values in this inclusive range are reserved for processor-specific semantics. If
		 * meanings are specified, the processor supplement explains them.
		 */
		STInfoTypesLoProcessor		= 13,
		/**
		 * Values in this inclusive range are reserved for processor-specific semantics. If
		 * meanings are specified, the processor supplement explains them.
		 */
		STInfoTypesHiProcessor		= 15
	};
	/**
	 * A symbol's visibility, although it may be specified in a relocatable object, defines how
	 * that symbol may be accessed once it has become part of an executable or shared object.
	 */
	enum STInfoVisibility {
		/**
		 * The visibility of symbols with the STInfoVisibilityDefault attribute is as specified by
		 * the symbol's binding type. That is, global and weak symbols are visible outside of their
		 * defining component (executable file or shared object). Local symbols are hidden, as
		 * described below. Global and weak symbols are also preemptable, that is, they may by
		 * preempted by definitions of the same name in another component.
		 */
		STInfoVisibilityDefault		= 0,
		/**
		 * The meaning of this visibility attribute may be defined by processor supplements to
		 * further constrain hidden symbols. A processor supplement's definition should be such that
		 * generic tools can safely treat internal symbols as hidden.
		 */
		STInfoVisibilityInternal	= 1,
		/**
		 * A symbol defined in the current component is hidden if its name is not visible to other
		 * components. Such a symbol is necessarily protected. This attribute may be used to control
		 * the external interface of a component. Note that an object named by such a symbol may still
		 * be referenced from another component if its address is passed outside.
		 */
		STInfoVisibilityHidden		= 2,
		/**
		 * A symbol defined in the current component is protected if it is visible in other components
		 * but not preemptable, meaning that any reference to such a symbol from within the defining
		 * component must be resolved to the definition in that component, even if there is a definition
		 * in another component that would preempt by the default rules. A symbol with STInfoBindingLocal
		 * binding may not have STInfoVisibilityProtected visibility. If a symbol definition with
		 * STInfoVisibilityProtected visibility from a shared object is taken as resolving a reference
		 * from an executable or another shared object, the SHeaderNumberUndefined symbol table entry
		 * created has STInfoVisibilityDefault visibility.
		 */
		STInfoVisibilityProtected	= 3
	};
	/**
	 * The symbol header number.
	 */
	enum SHeaderNumber {
		/**
		 * The symbol has an absolute value that will not change because of relocation.
		 */
		SHeaderNumberABS				= 0,
		/**
		 * The symbol labels a common block that has not yet been allocated.
		 */
		SHeaderNumberCommon			= 1,
		/**
		 * This section table index means the symbol is undefined. When the link editor combines this object
		 * file with another that defines the indicated symbol, this file's references to the symbol will be
		 * linked to the actual definition.
		 */
		SHeaderNumberUndefined		= 2,
		/**
		 * This value is an escape value. It indicates that the symbol refers to a specific location within
		 * a section, but that the section header index for that section is too large to be represented
		 * directly in the symbol table entry.
		 */
		SHeaderNumberXIndex			= 3
	};
};

}

#endif
